package dao;


import pojo.SysUser;

import java.sql.Connection;
import java.sql.PreparedStatement;

/**
 * SysUserDaoImpl
 *
 * @author boy
 * @since 2023/10/27
 */

public class SysUserDaoImpl {
    int add(Connection connection, SysUser sysUser) throws Exception{
        PreparedStatement pstmt=null;
        int updateRows=0;
        if (null!=connection){
            String sql="insert t_sys_user (account,realName,password,"+"roleId,sex,birthday,phone,address,createdTime"+
                    "createdUserId,idPicPath,workPicPath)"+"values(?,?,?,?,?,?,?,?,?,?,?,?)";
            Object[] prem={sysUser.getAddress(),sysUser.getRealName(),sysUser.getPassword(),
            sysUser.getRoleId(),sysUser.getSex(),sysUser.getBirthday(),sysUser.getPhone(),
            sysUser.getAddress(),sysUser.getCreatedTime(),sysUser.getCreatedUserId(),sysUser.getIdPicPath(),sysUser.getWorkPicPath()};
            updateRows=BaseDao.getConnection(connection,prem,sql,pstmt);
            BaseDao.closeResource(null,pstmt,null);
        }
        return updateRows;
    }
}
